<template>
	<!--新闻资讯-->
	
	<div>
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-media" v-for="item in newslist" :key='item.id'>
					<router-link :to="'/home/newsinfo/'+item.id">
						<img class="mui-media-object mui-pull-left" src="https://gitee.com/uploads/91/465191_vsdeveloper.jpg?1437703838">
						<!--这里的图片没有获取到   :src=item.img_url  -->
						<div class="mui-media-body">
							<h1>{{item.title}}</h1>
							<p class='mui-ellipsis'>
								<span>发表时间：{{item.add_time}}</span>
								<span>点击: {{item.click}}次</span>
							</p>
						</div>
					</router-link>
				</li>
				
				<!--<li class="mui-table-view-cell mui-media" >
					<router-link to="/home/newsinfo/1">
						<img class="mui-media-object mui-pull-left" 
							src="https://gitee.com/uploads/91/465191_vsdeveloper.jpg?1437703838">
						<div class="mui-media-body">
							<h1>幸福</h1>
							<p class='mui-ellipsis'>
								<span>发表时间：{{'2018-12-12 12:12:12'| dateFormat}}</span>
								<span>点击: 0次</span>
							</p>
						</div>
					</router-link>
				</li>
				<li class="mui-table-view-cell mui-media">
					<router-link to="/home/newsinfo/2">
						<img class="mui-media-object mui-pull-left" 
							src="https://gitee.com/uploads/91/465191_vsdeveloper.jpg?1437703838">
							
						<div class="mui-media-body">
							<h1>幸福</h1>
							<p class='mui-ellipsis'>
								<span>发表时间：{{ctime| dateFormat('YYYY-MM-DD')}}</span>
								<span>点击: 0次</span>
							</p>
						</div>
					</router-link>
				</li>
				<li class="mui-table-view-cell mui-media">
					<router-link to="'home/newsinfo/'+'3'">
						<img class="mui-media-object mui-pull-left" 
							src="https://gitee.com/uploads/91/465191_vsdeveloper.jpg?1437703838">							
						<div class="mui-media-body">
							<h1>幸福</h1>
							<p class='mui-ellipsis'>
								<span>发表时间：2012-12-12 12:12:12</span>
								<span>点击: 0次</span>
							</p>
						</div>
					</router-link>
				</li>-->

			</ul>
	</div>
</template>

<script>
	import  {Toast} from 'mint-ui'	
	export default {
		data(){
			return {
				newslist:[], //新闻列表
				ctime:'2018-09-09',
				dt:new Date()
			}
		},
		created(){
			this.getNewsList();
		},
		methods:{
			getNewsList(){ //获取新闻列表
				this.$http.get('api/getnewslist').then(result=>{
					if(result.body.status == 0){
						//如果成功了
						this.newslist = result.body.message;
						console.log('-->',this.newslist)
					}else{
						Toast('获取新闻列表失败')
					}
				})
			}
		}
	}


//	export default {
//		data(){
//			return {
//				newslist:[], //新闻列表
//				ctime:'2018-09-09',
//				dt:new Date()
//			}
//		},
//		created(){
//			
//		},
//		methods:{
//			
//		}
//	}

</script>

<style lang="scss" scoped>
	.mui-table-view{
		li{
			h1{font-size: 14px;}
			.mui-ellipsis{
			font-size: 12px;
			color: cornflowerblue;
			display: flex;
			justify-content: space-between;
		    }
		}
		
	}
</style>